package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.SpannableString;
import android.view.View;
import android.widget.ImageView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import com.huawei.appmarket.service.store.awk.bean.HorizontalPromoteProductCardBean;
import huawei.widget.HwTextView;
import o.azb;
import o.cgz;
import o.chm;
import o.chy;
import o.Logger;
import o.dof;
import o.eed;
import o.eqx;
import o.evf;
import o.evx;
import o.ewm.c;
import o.ewm.d;
import o.ewm.j;
import o.ewm.n;

public class HorizontalPromoteProductCard extends BaseHorizontalItemCard {
    private int ʻ;
    private ImageView ʼ;
    private HwTextView ʽ;
    private HwTextView ˋ;
    private HwTextView ॱॱ;
    private HwTextView ᐝ;

    public HorizontalPromoteProductCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ʼ = (ImageView) view.findViewById(j.ᵔˋ);
        this.ʽ = (HwTextView) view.findViewById(j.ᶥʽ);
        this.ᐝ = (HwTextView) view.findViewById(j.ᵗ);
        this.ˋ = (HwTextView) view.findViewById(j.ᕀॱ);
        this.ॱॱ = (HwTextView) view.findViewById(j.ⵈॱ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof HorizontalPromoteProductCardBean) {
            HorizontalPromoteProductCardBean horizontalPromoteProductCardBean = (HorizontalPromoteProductCardBean) cardBean;
            this.ʽ.setText(horizontalPromoteProductCardBean.ʻˋ());
            ॱ(this.ᐝ, horizontalPromoteProductCardBean);
            ˋ(this.ʼ, horizontalPromoteProductCardBean.ʼˊ());
            ॱ(this.ˋ, this.ॱॱ, horizontalPromoteProductCardBean);
            this.ʼ.setContentDescription(horizontalPromoteProductCardBean.v_());
        }
    }

    private void ॱ(HwTextView hwTextView, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        hwTextView.setText(horizontalPromoteProductCardBean.ʻˊ());
    }

    private void ˋ(ImageView imageView, String str) {
        eqx.ˏ(imageView, str, "app_big_icon");
    }

    private void ॱ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        if (horizontalPromoteProductCardBean.ॱꜟ() == 2) {
            ˎ(hwTextView, hwTextView2, horizontalPromoteProductCardBean);
        } else {
            ˊ(hwTextView, hwTextView2, horizontalPromoteProductCardBean);
        }
    }

    private void ˎ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        hwTextView2.setText(this.ʼॱ.getResources().getText(n.ʼꜞ));
        ˊ(hwTextView2);
        ˎ(hwTextView, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʻᐝ());
        hwTextView.setTextColor(evf.ॱ(this.ʼॱ, c.ॱˋ));
        hwTextView.setAlpha(azb.ˋ(this.ʼॱ, d.ʼॱ));
    }

    private void ˊ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        if (horizontalPromoteProductCardBean.ॱꞌ() > 0 || horizontalPromoteProductCardBean.ॱꞌ() == -1) {
            ˋ(hwTextView, hwTextView2, horizontalPromoteProductCardBean);
        } else {
            ˋ(hwTextView, hwTextView2);
        }
    }

    private void ˋ(HwTextView hwTextView, HwTextView hwTextView2) {
        hwTextView.setVisibility(8);
        hwTextView2.setText(this.ʼॱ.getResources().getText(n.ʼᶥ));
        ˊ(hwTextView2);
    }

    private void ˊ(HwTextView hwTextView) {
        hwTextView.setTextColor(evf.ॱ(this.ʼॱ, c.ͺ));
        hwTextView.setAlpha(azb.ˋ(this.ʼॱ, d.ʼॱ));
        hwTextView.setTextSize(0, (float) this.ʼॱ.getResources().getDimensionPixelSize(d.ˏˎ));
    }

    private void ॱ(HwTextView hwTextView) {
        hwTextView.setTextColor(evf.ॱ(this.ʼॱ, c.ॱᐝ));
        hwTextView.setAlpha(1.0f);
        hwTextView.setTextSize(0, (float) this.ʼॱ.getResources().getDimensionPixelSize(d.ʽॱ));
    }

    private void ˋ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        ॱ(hwTextView2);
        this.ʻ = ˋ(horizontalPromoteProductCardBean);
        if (horizontalPromoteProductCardBean.ॱꜟ() == 1) {
            ˏ(hwTextView, hwTextView2, horizontalPromoteProductCardBean);
        } else {
            ʻ(hwTextView, hwTextView2, horizontalPromoteProductCardBean);
        }
    }

    private int ˋ(HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        if (dof.ˋ(horizontalPromoteProductCardBean.ʼˋ()) && horizontalPromoteProductCardBean.ॱꜟ() == 0) {
            return 0;
        }
        long ʾॱ = horizontalPromoteProductCardBean.ʾॱ();
        if (ʾॱ <= 0) {
            return 3;
        }
        if (ʾॱ - System.currentTimeMillis() > 0) {
            return 1;
        }
        return 2;
    }

    private void ˏ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        if (this.ʻ == 2) {
            hwTextView.setVisibility(8);
            ˊ(hwTextView2, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʻᐝ());
            return;
        }
        hwTextView2.setText(this.ʼॱ.getResources().getText(n.ʼꜟ));
        ˎ(hwTextView, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʻᐝ());
    }

    private void ʻ(HwTextView hwTextView, HwTextView hwTextView2, HorizontalPromoteProductCardBean horizontalPromoteProductCardBean) {
        if (this.ʻ == 0 || this.ʻ == 2) {
            hwTextView.setVisibility(8);
            ˊ(hwTextView2, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʻᐝ());
            return;
        }
        ˊ(hwTextView2, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʼˋ());
        ˎ(hwTextView, horizontalPromoteProductCardBean.ʼᐝ(), horizontalPromoteProductCardBean.ʻᐝ());
    }

    private void ˎ(HwTextView hwTextView, String str, String str2) {
        CharSequence ॱ = ॱ(str, str2);
        if (dof.ˋ(ॱ)) {
            hwTextView.setVisibility(8);
            return;
        }
        hwTextView.setVisibility(0);
        CharSequence spannableString = new SpannableString(ॱ);
        spannableString.setSpan(chm.ॱ, 0, spannableString.length(), 33);
        hwTextView.setText(spannableString);
        hwTextView.setTextColor(evf.ॱ(this.ʼॱ, c.ॱˋ));
        hwTextView.setAlpha(1.0f);
    }

    protected void ˊ(HwTextView hwTextView, String str, String str2) {
        CharSequence ॱ = ॱ(str, str2);
        if (dof.ˋ(ॱ)) {
            hwTextView.setVisibility(8);
            return;
        }
        hwTextView.setVisibility(0);
        hwTextView.setText(ॱ);
    }

    public void ॱ(final chy o_chy) {
        View ˉ = ˉ();
        if (ˉ != null) {
            ˉ.setOnClickListener(new evx(this) {
                final /* synthetic */ HorizontalPromoteProductCard ˎ;

                public void ˋ(View view) {
                    o_chy.ˏ(0, this.ˎ);
                }
            });
        }
    }

    private String ॱ(String str, String str2) {
        String str3 = null;
        try {
            if (Float.valueOf(str2).floatValue() > 0.0f) {
                str3 = eed.ˋ(str, str2);
            }
        } catch (Exception e) {
            Logger.ˋ("HorizontalPromoteProductCard", "getPriceContent error");
        }
        return str3;
    }
}
